/**
 * 
 */
package com.easidea.tim.entity.finance;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springside.core.dao.extend.Undeletable;

import com.easidea.tim.entity.BaseEntity;
import com.easidea.tim.entity.customer.Customer;

/**
 * 
 * 客户收支流水，用于登记客户方面的所有财务数据的变更，每个客户每次发生均会产生一个记录
 * 
 * @author Harrison
 */
@Entity(name="tim_finance_customer_account_listing")
@org.hibernate.annotations.Entity(dynamicInsert=true,dynamicUpdate=true)
@Cache(region="tim_finance_customer_account_listing", usage=CacheConcurrencyStrategy.READ_WRITE)
@Undeletable(status="deleted")
public class CustomerAccountListing extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2664873853901649937L;
	
	
	private Double amount; // 本次变动金额
	private Double lastAmount; // 期初金额 （应收款）
	private Double totalAmount; // 目前的余额（应收款）
	private String memo; // 摘要
	private FinanceItem item; // 科目
	private String itemName; // 科目名称
	private Customer customer; // 对应客户
	private String customerName; //客户名称
	
	
	/**
	 * @return the amount
	 */
	@Column(name="amount",nullable=false)
	public Double getAmount() {
		return amount;
	}
	/**
	 * @param amount the amount to set
	 */
	public void setAmount(Double amount) {
		this.amount = amount;
	}
	/**
	 * @return the lastAmount
	 */
	@Column(name="last_amount",nullable=false)
	public Double getLastAmount() {
		return lastAmount;
	}
	/**
	 * @param lastAmount the lastAmount to set
	 */
	public void setLastAmount(Double lastAmount) {
		this.lastAmount = lastAmount;
	}
	/**
	 * @return the memo
	 */
	@Column(name="memo",nullable=false,length=5000)
	public String getMemo() {
		return memo;
	}
	/**
	 * @param memo the memo to set
	 */
	public void setMemo(String memo) {
		this.memo = memo;
	}
	/**
	 * @return the item
	 */
	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn(name="item_id")
	public FinanceItem getItem() {
		return item;
	}
	/**
	 * @param item the item to set
	 */
	public void setItem(FinanceItem item) {
		this.item = item;
	}
	/**
	 * @return the customer
	 */
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="customer_id")
	public Customer getCustomer() {
		return customer;
	}
	/**
	 * @param customer the customer to set
	 */
	public void setCustomer(Customer customer) {
		this.customer = customer;
	}
	/**
	 * @return the totalAmount
	 */
	@Column(name="total_amount")
	public Double getTotalAmount() {
		return totalAmount;
	}
	/**
	 * @param totalAmount the totalAmount to set
	 */
	public void setTotalAmount(Double totalAmount) {
		this.totalAmount = totalAmount;
	}
	/**
	 * @return the itemName
	 */
	@Column(name="item_name")
	public String getItemName() {
		return itemName;
	}
	/**
	 * @param itemName the itemName to set
	 */
	public void setItemName(String itemName) {
		this.itemName = itemName;
	}
	/**
	 * @return the customerName
	 */
	@Column(name="customer_name")
	public String getCustomerName() {
		return customerName;
	}
	/**
	 * @param customerName the customerName to set
	 */
	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}
	

}
